/**
 * 
 */
package com.nouvasys.sample.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.nouvasys.sample.dao.EmployeeDAO;
import com.nouvasys.sample.model.Employee;

/**
 * @author Ashwath
 *
 */
public class EmployeeDAOImpl extends HibernateDaoSupport implements EmployeeDAO {

	/* (non-Javadoc)
	 * @see com.nouvasys.sample.dao.EmployeeDAO#addEmployee(com.nouvasys.sample.model.Employee)
	 */
	public void addEmployee(Employee emp) {
		getHibernateTemplate().save(emp);

	}

	/* (non-Javadoc)
	 * @see com.nouvasys.sample.dao.EmployeeDAO#deleteEmployee(com.nouvasys.sample.model.Employee)
	 */
	public void deleteEmployee(Employee emp) {
		getHibernateTemplate().delete(emp);

	}

	/* (non-Javadoc)
	 * @see com.nouvasys.sample.dao.EmployeeDAO#searchEmployee(java.lang.String)
	 */
	public List<Employee> searchEmployee(String employeeName) {
		String queryString = "FROM Employee where firstName LIKE '%" + employeeName + "%'";
		
		return (List<Employee>)getHibernateTemplate().find(queryString);
	}

}
